#ifndef __DAF_EVENT_H__
#define __DAF_EVENT_H__

#include "daf_model.h"
#include "daf_event_store.h"

#include "gazella/interface_timer.h"

#include <string>
#include <vector>
#include <map>

namespace Gazella {
namespace Daf {

struct DafEventArg: public ITimerCallbackArg {
    DeviceAgentMessage::DeviceAgentAbilityElement event_ability; 
};

class DafEvent {
private:
    DafEvent();
    ~DafEvent();

public:
    static DafEvent* get_instance();
    void init();

    //proactively send event once 
    static bool event_once(const std::string& ability_identifier);

private:
    void __event_period_callback(std::shared_ptr<ITimerCallbackArg>);
    void __event_rulecheck_callback(std::shared_ptr<ITimerCallbackArg>);

private:
    std::vector<DeviceAgentMessage::DeviceAgentAbilityElement> m_event_abilities;

    //key: event_ability_identifier
    std::map<std::string, DafEventStore> m_event_store;
};
} // namespace Daf
} // namespace Gazella

#endif